led = 4
gpio.mode(led,gpio.OUTPUT,gpio.PULLUP)
wifi.setmode(wifi.STATION)
wifi.sta.config({ssid="@PHICOMM_DC",pwd="123321000"})
t = tmr.create()
t:register(1000,tmr.ALARM_AUTO,function()
    if wifi.sta.getip() == nil then
        print("connecting...")
    else 
       t:stop() 
       print("connected,Ip is "..wifi.sta.getip()) 
       main()
    end
end)
t:start()
function main()
	http.get("http://wthrcdn.etouch.cn/weather_mini?city=佳木斯", nil, function(code, data)
    if (code < 0) then
      print("HTTP request failed")
    else
      print(code, data)
   --   t = cjson.decode()
    --  for k,v in pairs(t) do print(k,v) end
    end
  end)
end
